package com.me.study.javaBasic.accessModifier.packg1;

/**
 * 访问修饰符测试：同包子类
 * public 可访问，protected、default 可访问，、private 不可访问，
 *
 * @author ME
 * @date   2020/5/20
 */
public class ClassChild1 extends ClassParent {

    public static void main(String[] args) {
        ClassParent parent = new ClassParent();
        ClassChild1 child = new ClassChild1();

        // public
        System.out.println(parent.publicStr);
        parent.getPublicStr();
        System.out.println(child.publicStr);
        child.getPublicStr();

        // protected
        System.out.println(parent.protectedStr);
        parent.getProtectedStr();
        System.out.println(child.protectedStr);
        child.getProtectedStr();

        // default
        System.out.println(parent.defaultStr);
        parent.getDefaultStr();
        System.out.println(child.defaultStr);
        child.getDefaultStr();

        // private
        System.out.println(parent.priStr);
        parent.getPriStr();
        System.out.println(child.priStr);
        child.getPriStr();
    }
}
